package IOperate;

import book.BookList;

import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */
public class BrowwedBook implements Ioperate{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        int count = bookList.size;
        System.out.println("请输入要借阅的书名：");
        String name = scanner.nextLine();

        for (int i = 0; i < count; i++) {
            if(name.equals(bookList.getBooks(i).getName())){
                bookList.getBooks(i).setIsbool(true);
                System.out.println("借阅成功！");
                System.out.println();
                return ;
            }
        }
        System.out.println("此书不存在!");
        System.out.println();
    }
}
